package make.free.app.mcaro.game;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.entity.primitive.Rectangle;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.input.touch.TouchEvent;

import android.content.Context;

public class Title {
	private Scene mScene;
	private int x, y, positionX, positionY;

	public Title(Engine mEngine, Scene mScene, Context mContext) {
		super();
		this.mScene = mScene;
	}

	private void createTile(final int positionX, final int positionY) {
		Rectangle rec = new Rectangle(positionX, positionY, 23, 58) {
			@Override
			public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
					float pTouchAreaLocalX, float pTouchAreaLocalY) {
				// TODO Auto-generated method stub
				if (EventTitle.onclickItem == true) {
					if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
						// X danh0 = new X(mScene, mEngine, mContext);
						// danh0.onLoadResources();
						// danh0.onLoadScene(positionX, positionY, x, y);
						EventTitle.click(Title.this);
						EventTitle.count = EventTitle.count + 1;
					}
				}
				return true;

			}
		};
		mScene.registerTouchArea(rec);
		mScene.attachChild(rec);
	}

	public void onCreateTitles(int positionX, int positionY, int x, int y) {
		createTile(positionX, positionY);
		this.positionX = positionX;
		this.positionY = positionY;
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getPositionX() {
		return positionX;
	}

	public void setPositionX(int positionX) {
		this.positionX = positionX;
	}

	public int getPositionY() {
		return positionY;
	}

	public void setPositionY(int positionY) {
		this.positionY = positionY;
	}

}
